Skip to content

ZSTAC-86788: set first created zone default#4579

Closed
zstack-robot-2 wants to merge 1 commit into
5.4.12from
sync/hanyu.liang/fix-86788
Closed

ZSTAC-86788: set first created zone default#4579
zstack-robot-2 wants to merge 1 commit into
5.4.12from
sync/hanyu.liang/fix-86788

Conversation

@zstack-robot-2

Copy link
Copy Markdown
Collaborator

Backport of ZSTAC-75952 to 5.4.12.

Source: zstack!10404 (5.5.28).

Sets the first zone created on a fresh installation as the default zone.

Validation: static diff and commit checks only; no case was run per backport requirement.

sync from gitlab !10548

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 6 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: bd56461b-59da-4e77-a01d-aa436329b558

📥 Commits

Reviewing files that changed from the base of the PR and between dfbed98 and 9abf937.

📒 Files selected for processing (3)
  • compute/src/main/java/org/zstack/compute/zone/ZoneManagerImpl.java
  • conf/db/upgrade/V5.4.12__schema.sql
  • test/src/test/groovy/org/zstack/test/integration/compute/ZoneCase.groovy

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Could not fetch remote config from http://open.zstack.ai:20001/code-reviews/zstack-cloud.yaml: TimeoutError: The operation was aborted due to timeout
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

调整 Zone 创建时的默认标记条件,新增升级脚本回填缺失的默认 Zone,并在集成测试中验证首个 Zone 会成为唯一默认 Zone。

Changes

默认 Zone 行为

Layer / File(s) Summary
Zone 创建默认值逻辑
compute/src/main/java/org/zstack/compute/zone/ZoneManagerImpl.java
仅当请求未指定 default 且不存在 Zone 记录时自动设置默认标记;default=null 请求进入链式处理流程。
升级脚本回填默认 Zone
conf/db/upgrade/V5.4.12__schema.sql
新增并执行临时存储过程,在缺少默认 Zone 时选择最早创建的 Zone 进行回填,随后删除该过程。
首个 Zone 默认行为验证
test/src/test/groovy/org/zstack/test/integration/compute/ZoneCase.groovy
新增测试并加入执行链,验证首个 Zone 及数据库记录被标记为默认,且默认 Zone 数量为 1。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant ZoneManagerImpl
  participant Database
  participant ZoneCase
  Client->>ZoneManagerImpl: 创建首个 Zone
  ZoneManagerImpl->>Database: 查询并保存默认标记
  Database-->>ZoneManagerImpl: 返回 Zone 记录
  ZoneManagerImpl-->>Client: 返回创建结果
  ZoneCase->>Database: 查询默认 Zone
  Database-->>ZoneCase: 返回唯一默认 Zone
Loading

Poem

小兔挥爪改 Zone,
首个区域戴王冠。
数据库里补旧缺,
测试蹦跳数一番。
默认旗帜稳稳安。

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 标题准确概括了首个创建的 zone 被设为默认的核心变更。
Description check ✅ Passed 描述与补丁内容一致,说明了回迁来源、目标行为和验证方式。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sync/hanyu.liang/fix-86788

Comment @coderabbitai help to get the list of available commands.

@MatheMatrix
MatheMatrix force-pushed the sync/hanyu.liang/fix-86788 branch from 2d6b51e to dd8dc50 Compare July 16, 2026 09:56
@zstack-robot-2

Copy link
Copy Markdown
Collaborator Author

Comment from gitlab:

检测到该PR状态为cannot_be_merged, 所以移除了REVIEWED标签

DBImpact

Resolves: ZSTAC-86788

Change-Id: I746dc070d672e8191a0bf4bf995584ca5f5b8266
@MatheMatrix
MatheMatrix force-pushed the sync/hanyu.liang/fix-86788 branch from dd8dc50 to 9abf937 Compare July 17, 2026 08:36
@ZStack-Robot
ZStack-Robot deleted the sync/hanyu.liang/fix-86788 branch July 17, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants